package region

import (
	"context"

	v1 "gitee.com/liangziyisheng/caas-platform-mc/api/region/v1"
	"gitee.com/liangziyisheng/caas-platform-mc/internal/service"
	"gitee.com/liangziyisheng/caas-platform-mc/utility/utils"
)

func (c *ControllerV1) Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error) {
	// return nil, gerror.NewCode(gcode.CodeNotImplemented)
	in := &v1.AddInput{}
	utils.CopyStruc(*req, in)
	out, err := service.Region().Add(ctx, in)
	if err != nil {
		return nil, err
	}
	return &v1.AddRes{
		Id: out.Id,
	}, nil
}
